#include <stdio.h>
// 定义常量
#define FREEZING_PT 32.0f
#define SCALE_FACTOR (5.0f / 9.0f)

void dweight2();
void celsius();

int chapter2_main() {
//    dweight2();
    celsius();
    return 0;
}

void example() {

}
// example 2.1 暂时没有发现警告 c11
//int main(void) {
////    chapter2_main();
//    printf("hello, world\n");
//}
// 常量 华氏温度转换为摄氏温度
void celsius() {
    float fahrenheit, celsius;

    printf("Enter Fahrenheit temperature: ");
    scanf("%f", &fahrenheit);

    celsius = (fahrenheit - FREEZING_PT) *SCALE_FACTOR;
    // 只显示一位小数
    printf("Celsius equivalent: %.1f\n", celsius);
}

// 用户输入
void dweight2() {
    int height,length, width, volume, weight;

    printf("Enter height of Box: ");
    // 用户输入
    scanf("%d", &height);
    printf("Enter length of Box: ");
    scanf("%d", &length);
    printf("Enter width of Box: ");
    scanf("%d", &width);
    volume = height * length * width;
    weight = (volume + 165) / 166;

    printf("Volume (cubic inches): %d\n", volume);
    printf("Dimensional weight (pounds): %d\n", weight);
}

void number_example() {
    float profit = 2150.48;
    int length = 3;
    printf("Hello, World!\n");
    printf("Profit: $%.2f\n", profit);
    printf("length: $%d\n", length);
}